package com.study.行为型模式.中介者模式;

import com.sun.xml.internal.ws.resources.SenderMessages;

//具体的同事类
public class Alarm extends Colleague{

    //构造器
    public Alarm(Mediator mediator, String name) {
        super(mediator, name);
        //在创建类对象时，将自己放入到ConcreteMediator对象中
        mediator.register(name,this);
    }

    public void SendAlarm(int stateChange){
        sendMessage(stateChange);
    }

    @Override
    public void sendMessage(int stateChange) {
        //调用的中介者对象的getMessage
        this.getMediator().getMessage(stateChange,this.name);
    }
}
